package com.zengqingfa.thread.demo1;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

/**
 * @fileName: CreateThread
 * @author: zengqf3
 * @date: 2020-10-7 11:24
 * @description:
 */
@Slf4j(topic = "CreateThread2")
public class CreateThread2 implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i < 50; i++) {
            System.out.println(Thread.currentThread().getName() + " i am coding " + i);
        }
    }

    public static void main(String[] args) {
        CreateThread2 createThread2 = new CreateThread2();
        Thread thread = new Thread(createThread2);
        //开启一个线程
        thread.start();
        //主线程
        for (int i = 0; i < 100; i++) {
            System.out.println(Thread.currentThread().getName() + " i am study muti-thread  " + i);
        }
    }

    @Test
    public void test1() {
        new Thread(() -> {
           log.debug("t1 start");
        }, "t1").start();
    }
}
